<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<div class="pad-10">
<form name="myform" action="?m=experience_type&c=manage&a=add" method="post" id="myform" enctype="multipart/form-data">
<div class="content pad-10" id="show_div_1" style="height:auto">
		<table width="100%" class="table_form">
			<tr>
				<td width="120"><?php echo L('experience_type_name')?>：</td>
				<td>
					<input type="text" name="data[name]" id="name"  class="input-text" value="" />
				</td>
			</tr>
			<tr>
				<td width="120"><?php echo L('experience_type_en_name')?>：</td>
				<td>
					<input type="text" name="data[en_name]" id="en_name"  class="input-text" value="" />
				</td>
			</tr>
			
			<tr>
				<td width="120"><?php echo L('experience_type')?>：</td>
				<td>
					<select name="data[experience_type_id]">
						<option value="0"><?php echo L('please_select_parent_category')?></option>
						<?php 
							foreach ($experience_type as $v){
						?>
						<option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
							<?php foreach ($v['child'] as $vs) {?>
							<option value="<?php echo $vs['id']?>">┣<?php echo $vs['name']?></option>
							<?php 
								}
							?>
						<?php 
							}
						?>
					</select>
				</td>
				
			</tr>
			
		</table>


</div>
    <div class="bk15"></div>
    <input name="dosubmit" type="submit" id="dosubmit" value="<?php echo L('submit')?>" class="button">


</form>
</div>
<script type="text/javascript">
<!--
function IsLetters(str){
	if(!(/^[A-Za-z]+$/.test(str)))return "请输入正确的英文名称";
	return true;
}
//-->
</script>
<script type="text/javascript">
$(document).ready(function() {
	$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'})}});
	$("#name").formValidator(
			{onshow:"<?php echo L('input').L('experience_type_name')?>",
			 onfocus:"<?php echo L('input').L('experience_type_name')?>"}
	).inputValidator(
			{min:1,onerror:"<?php echo L('input').L('experience_type_name')?>"}
	).ajaxValidator({type:"GET",url:"",data:"m=experience_type&c=manage&a=experience_check",datatype:"html",cache:false,async:"true",success:function(data){
				if(data == '1'){
					return true;
					}
				else{
					return false;
					}
				},
			error:function(){
					alert("<?php echo L('server_no_data')?>")
				},
			onerror : "<?php echo L('experience_type_exist')?>",
			onwait : "<?php echo L('checking')?>"
	});
	$("#en_name").formValidator(
			{onshow:"<?php echo L('input').L('experience_type_en_name')?>",
			 onfocus:"<?php echo L('input').L('experience_type_en_name')?>"}
	).inputValidator(
			{min:1,onerror:"<?php echo L('input').L('experience_type_en_name')?>"}
	).functionValidator({fun:IsLetters}).ajaxValidator({type:"GET",url:"",data:"m=experience_type&c=manage&a=experience_check",datatype:"html",cache:false,async:"true",success:function(data){
		if(data == '1'){
			return true;
			}
		else{
			return false;
			}
		},
	error:function(){
			alert("<?php echo L('server_no_data')?>")
		},
	onerror : "<?php echo L('experience_type_exist')?>",
	onwait : "<?php echo L('checking')?>"
});
	

});
</script>
</body>
</html>